package com.hqyj.controller;

import com.hqyj.pojo.UserInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/day01")
public class DayOneController {

    //访问hello页面的方法
    @RequestMapping("/hello")
    public String day01(Model map){
        //map.addAttribute("info","你好");
        List<UserInfo> userInfoList = new ArrayList<>();
        for(int i=0;i<8;i++){
            UserInfo userInfo =new UserInfo();
            //userInfo.setUId(i);
            userInfo.setUserName("李"+i);
            userInfoList.add(userInfo);
        }
        map.addAttribute("info",userInfoList);
        return "/day01/hello";
    }

    //访问index页面
    @RequestMapping("/index")
    public String index(){
        return "/day01/index";
    }
}
